package com.project.controller;

import com.project.bean.PieBean;
import com.project.service.IPieService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.List;

@RestController
//根据指定权限访问方法
@RequiresPermissions("salesTable")
@RequestMapping("pie")
public class PieController {
    @Autowired
    private IPieService pieService;
//    @RequiresPermissions("user:pie")
    @RequestMapping("findByType")
    public List<PieBean> findByType(LocalDate startDate, LocalDate endDate) {
        return pieService.findByType(startDate, endDate);
    }

    @RequestMapping("findByKind")
    public List<PieBean> findByKind(LocalDate startDate, LocalDate endDate) {
        return pieService.findByKind(startDate, endDate);
    }
}
